import parseDate from './parseDate';

/**
 * @description: 根据生日获取星座
 * @param {Date|Number|String} date
 * @return {String}
 */
export default function getAstro(date) {
  date = parseDate(date);
  const month = date.getMonth() + 1;
  const day = date.getDate();
  const s = '摩羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手摩羯';
  const arr = [20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22];
  return s.substr(month * 2 - (day < arr[month - 1] ? 2 : 0), 2);
}
